#include<iostream>
#include<cmath>
using namespace std; 
struct Polar
{
	double distance;
	double angle;
};

struct Rect
{
	double x;
	double y;
};

void rect_to_polar(const Rect* pr, Polar* pp);
void show_polar(const Polar* pp);

int main()
{
	Rect rect{};
	cout << "give x and y:";
	while (cin >> rect.x >> rect.y)
	{
		Polar polar{};
		rect_to_polar(&rect, &polar);
		show_polar(&polar);
		cout << "Next xy:";
	}
	return 0;
}

void rect_to_polar(const Rect* pr, Polar* pp)
{
	pp->distance = sqrt(pr->x * pr->x + pr->y * pr->y);
	pp->angle = atan2(pr->y, pr->x);
}

void show_polar(const Polar* pp)
{
	const double trans = 57.29577951;
	
	cout << "distance = " << pp->distance << endl;
	cout << "angle = " << pp->angle * trans << "degrees" <<endl;
}
